package org.gitweb.web.controller;

import org.gitweb.pojo.GitUser;
import org.gitweb.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName cn.saytime.web.UserController
 * @Description
 * @date 2017-07-04 22:46:14
 */
@RestController
public class UserController {

	@Autowired
	private UserService userService;

	/**
	 * 根据ID查询用户
	 * 
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "user/{id}", method = RequestMethod.GET)
	public String getUserById(@PathVariable(value = "id") Integer id) {
		GitUser user = userService.getUserById(id);
		return user.getUsername();
	}

}